package weba_Examen.webaExamen2;

import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

import modelo.HibernateUtil;
import modelo.pojos.Personas;

/**
 * Hello world!
 * 
 */
public class App {
	
	public static void main(String[] args) {
		System.out.println("Hello World!");
		Session s = HibernateUtil.getSessionFactory().getCurrentSession();
		List l = null;
		Transaction tx = s.getTransaction();
		try {
			tx.begin();
			Query q = s.createQuery("from Usuario");
			l = q.list();
			tx.commit();
		} catch (HibernateException he) {
			// TODO: handle exception
			he.printStackTrace();
		} finally {
			if (tx != null && tx.isActive()) {
				tx.rollback();
			}
		}

		System.out.println(l);
	}
}
